function checkTrajectory(~,~,~,~)
% check = checkTrajectory(Y,U,Xobs,TestTrack)
%
% Given a trajectory/input, a cell array of obstacles, and a TestTrack,
% return true if the trajectory leaves the track, hits any obstacles, or 
% exceeds any input limits.
%
% NOTE: the trajectory is only for the vehicle's center of mass, so we
% are not checking if the "corners" of the vehicle leave the track or hit
% any obstacles.
%
% INPUTS:
%   Y           an N-by-2 trajectory in the x and y coordinates of the
%               vehicle's states, where the first column is x and the
%               second column is y OR an N-by-6 trajectory in the full
%               state, where the first column is x and the third column is
%               y
%
%   U           an N-by-2 vector of inputs, where the first column is the
%               steering angle and the second column is the rear wheel
%               driving force
%   
%   Xobs        a 1-by-Nobs cell array where each cell contains a 4-by-2
%               obstacle definition, as would be generated by the
%               generateRandomObstacles function (this is an optional
%               argument, so leave it out if your trajectory doesn't avoid
%               any obstacles)
%
%   TestTrack   a TestTrack object for which TestTrack.cline is the
%               centerline (this is an optional argument; the function will
%               by default try to load the provided TestTrack.mat file)
%
% OUTPUTS:
%   check       a boolean that is true if the trajectory crashes, hits any
%               obstacles, or exceeds any control inputs; note that this
%               boolean will return FALSE if your car crosses the finish
%               line (without leaving the track or hitting obstacles)
%
% Written by: Shreyas Kousik
% Created: 13 Nov 2017
% Modified: 12 Dec 2017
end